<!-- <link rel="stylesheet" href="${contextPath}/static/hotel/frontoffice/css/reservation.css?v=4" /> -->

<!-- 选中样式 -->
<!-- <link rel="stylesheet" href="${contextPath}/static/hotel/frontoffice/js/plug-ins/cashiering/cash_payment_postcredit/hsradiogrid/css/hscheckboxgrid.css" /> -->
<!-- <link rel="stylesheet" href="${contextPath}/static/hotel/frontoffice/js/plug-ins/cashiering/cash_payment_postcredit/hsradiogrid/css/hsradiogrid.css" /> -->
<!-- <link rel="stylesheet" href="${contextPath}/static/hotel/assets/css/jquery.gritter.css" /> -->

<!-- 数字键盘样式 -->
<!-- <link rel="stylesheet" href="${contextPath}/static/pos/js/posorder/keyboard/css/digitalCalculator.css" /> -->
<!-- <link rel="stylesheet" href="${contextPath}/static/hotel/frontoffice/js/popover/css/jquery.webui-popover.min.css" /> -->

<link rel="stylesheet" href="assets/css/ui.jqgrid.css"/>
<link rel="stylesheet" href="css/cashier_mana/spa_guestAccount.css"/>
<link rel="stylesheet" href="css/cashier_mana/reservation.css"/>

<!-- 使用优惠券 -->
<link rel="stylesheet" href="css/E_coupon/coupon_get1.css"/>
<link rel="stylesheet" href="css/E_coupon/coupon_get2.css"/>

<style>
	.profile-info-name {
	    text-align: right;
	    padding: 6px 10px 6px 4px;
	    font-weight: normal;
/* 	    color: #667E99; */
	    background-color: transparent;
	    border-bottom: 1px dotted #D5E4F1;
	    border-top: 0px dotted #D5E4F1 !important;
	    display: table-cell;
	    width: 80px;
	    width:100px;
	    vertical-align: middle;
	    color : black !important;
	}
	
	.profile-info-value {
	    display: table-cell;
	    padding: 6px 4px 6px 6px;
	    border-bottom: 1px dotted #D5E4F1;
	    border-top: 0px dotted #D5E4F1 !important;
	}
	
	.profile-info-value span{
	    font-size: 15px;
	    color: cornflowerblue !important;
	}
	
	.profile-info-value span.editable-empty{
	    font-size: 12px;
	    color: #BBB !important;
	}
	
	.profile-info-name {
	    border-top: none;
	}
	
	.profile-info-row:first-child .profile-info-name {
	    border-top: none;
	}
	.profile-info-row:first-child .profile-info-value {
	    border-top: none;
	}
	
	.profile-info-row:last-child .profile-info-name {
	    margin-bottom: 5px;
	}
	.profile-info-row:last-child .profile-info-value {
	    margin-bottom: 5px;
	}
	
	.rightXsxmTitle{
      -moz-user-select:none;
      -webkit-user-select: none;       
      -ms-user-select: none;     
	}
	
</style>
<!-- 遮罩层 -->
<div id="pageOverlay" class="hide"></div>
<!-- 等待动画 -->
<div id="loading" class="loading hide">						
	<i class="ace-icon fa fa-spinner fa-spin orange bigger-250"></i>
</div>
<div id="pageBox" class="row" style="margin-top:-12px !important">
	<div class="col-sm-12 no-padding">
		<div id="left" class=" no-padding" style="width: calc(30% + 59px);float: left;border-right: 1px solid #ccc; ">
			<div id="pageTopLeft">
				<span id="pageThBox" style="width:40%;height: 72px;padding:5px;padding-left:10px;line-height: 62px;">
					<span id="pageThArrowed"  class="width-90 label label-info label-xlg arrowed-right" style="zoom: 150%;font-size:12px;padding:0px;line-height: 26px;font-size:12px;color:white;font-weight: bold;">
	<!-- 						<font id="pageTh" style="font-size:12px;zoom:80%;color:white;font-weight: bold;"></font> -->
						<span id="pageTh" style="line-height: 28px;"></span>
						<span id="pageThIcon" style="line-height: 28px;"></span>
					</span>
				</span>
				<span class="" style="width:60%;">
					<span class="col-sm-12" style="border-bottom: 1px dotted #ccc;height: 36px;line-height: 36px;">
						<span class="col-sm-3" data-i18n="接待号">接待号</span>
						<span class="col-sm-9">
							<span id="pageJDH" style="cursor:pointer;font-size: 14px;">0</span>
							<span id="" style="cursor:pointer;color:#999999ba;font-size: 12px;margin-left: 10px;">NO.</span>
							<span id="pageNo" style="cursor:pointer;color:#999999ba;font-size: 12px;"></span>
						</span>
					</span>
					<span class="col-sm-12" style="height: 36px;line-height: 36px;">
<!-- 						<span class="col-sm-3" data-i18n="金额">金额</span> -->
<!-- 						<span class="col-sm-9"> -->
<!-- 							<span id="pageJe" style="font-size: 14px;">0.00</span> -->
<!-- 						</span> -->
					</span>
				</span>
			</div>
			<div id="pageCenterLeft">
				<div id="pageLeft"></div>
				<div id="pageLeft1" class="hide"></div>
				<div id="pageMid">
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnSetFlag" data-i18n="主牌">主牌</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnReturnDish" data-i18n="退还">退还</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnChangeTable" data-i18n="换牌">换牌</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnSpaPresent" data-i18n="赠送">赠送</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnDiscount" data-i18n="单品折扣">单品折扣</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnDiscountAmount" data-i18n="折扣金额">折扣金额</button>
					<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnPrice" data-i18n="单价">单价</button>
					<div class="divBottom">
						<button class="btn btn-app btn-grey btn-xs oper_btn" id="btnMemberCard" data-i18n="身份">身份</button>
					</div>
				</div>
			</div>
			<div id="pageBottomLeft">
<!-- 				<div id="pointListContent" class="hide" style="justify-content: center; text-align: center;flex: 1;float: left;"> -->
<!-- 					<span class="bigger pay_p" id="pointListActual" style="color:green;font-size:20px;font-weight:bold;"></span> -->
<!-- 				</div> -->
<!-- 				<div id="payableContent" style="justify-content: center; text-align: center;flex: 1;float: left;"> -->
<!-- 					<span class="bigger pay_p"  style="color:green;font-size:20px;font-weight:bold;">(<span id="payable">0</span>)</span> -->
<!-- 				</div> -->
				<div id="pageJeContent" style="justify-content: center; text-align: center;flex: 1;float: left;">
					<span id="pageJe" style="color:green;font-size:20px;font-weight:bold;">0.00</span>
				</div>
				<div id="bottom_btn_div" style="float: right;">
					<button class="btn btn-large btn-yellow  bottom_btn_left hide" id="selectOrder"  >单点</button>
					<button class="btn btn-large btn-yellow  bottom_btn_left" id="selectMultiOrder"  >点单</button>
	<!-- 				<button class="btn btn-large btn-yellow  bottom_btn_left" id=""  >优惠</button> -->
					<button class="btn btn-large btn-info  bottom_btn_left" id="selectTable"  >选择</button>
				</div>
			</div>
			
		</div>
		<div  id="right" class=" no-padding" style="width: calc(70% - 59px);float: left;">
			<div id="pageTopRight">
				<div class="col-sm-12 no-padding">
					<div class="col-sm-12 no-padding" style="border-bottom: 1px dotted #ccc;height: 36px;float:left;">
						<div class=" " style="padding: 6px 10px 6px 4px;text-align: right;width:100px;float:left;">
							接待号:
						</div>
						<div id="pageJdh" class=" " style="padding: 6px 10px 6px 4px;text-align: left;float:left;">
						
						</div>
						<div id="pageInfo1" class=" " style="padding: 6px 10px 6px 4px;text-align: left;float:left;">
						
						</div>
					</div>
					<div class="col-sm-12 no-padding">
						<div class="col-sm-2 " style="padding: 6px 10px 6px 4px;text-align: right;width:100px;float:left;">
							备注:
						</div>
						<div id="pageInfo2" class="col-sm-10 " style="padding: 6px 10px 6px 4px;text-align: left;">
						</div>
					</div>
				</div>
			</div>
			<div id="pageCenterRight">
				<div id="pageRight" ></div>
				<div id="pageRightLedger" ></div> 
			</div>
			<div id="pageBottomRight">
			
				<div style="float: left;line-height: 25px;">
					<div id="pointListContent" class="hide" style="justify-content: center; text-align: center;float: left;height: 25px;">
						<span class="bigger pay_p" id="pointListActual" style="color:#ff6a00;font-size:20px;font-weight:bold;"></span>
					</div>
					<div id="payableContent" style="justify-content: center; text-align: center;float: left;height: 25px;">
						<span class="bigger pay_p"  style="color:#ff6a00;font-size:20px;font-weight:bold;"><span id="payable">0</span></span>
					</div><br/>
					<label class="">多选:</label>
					<label>
						<input id="btnMulti" name="switch-field-1" class="ace ace-switch ace-switch-7" type="checkbox" />
						<span class="lbl" style="top: 8px;"></span>
					</label>
				</div>
<!-- 				<button class="btn btn-app btn-grey btn-sm  bottom_btn" id="btnShowFtp"  >手牌</button> -->
				<button class="btn btn-app btn-grey btn-sm  bottom_btn hide" id="btnShowXsxm"  >明细</button>
				<button class="btn btn-app btn-grey btn-sm  bottom_btn hide" id="btnXsxmFilter"  >过滤</button>
				<button class="btn btn-app btn-grey btn-sm  bottom_btn" id="btnXsxmOut"  >已结</button>
				
				
<!-- 				<button class="btn btn-app btn-light  bottom_btn" id="btnGoFirst" style="background:#9889c1 !important;color:white !important;float: right;" >全结先走</button> -->
<!-- 				<button class="btn btn-app btn-light  bottom_btn" id="btnCheckOut" style="background:#9889c1 !important;color:white !important;float: right;" >结账离店</button> -->
<!-- 				<button class="btn btn-app btn-light  bottom_btn" id="btnCheckOut" style="background:#9889c1 !important;color:white !important;float: right;" >选择结账</button> -->
			
				<button class="btn btn-app btn-grey btn-sm bottom_btn" id="btnBack" style="float: right;" >返回</button>
<!-- 				<button id="btnCheckOut" class="btn btn-app btn-light btn-sm bottom_btn popover-error btn-purple" type="button" data-content="" style="background:#9889c1 !important;color:white !important;float: right;"> -->
<!-- 					结账 -->
<!-- 				</button> -->
<!-- 				<button id="btnSplitCombine" class="btn btn-app btn-light btn-sm bottom_btn popover-error" type="button" data-rel="popover" data-placement="top" data-original-title="其他" data-content="" style="background:#9889c1 !important;color:white !important;float: right;"> -->
<!-- 					其他 -->
<!-- 				</button> -->
<!-- 				<button class="btn btn-app btn-grey btn-sm bottom_btn" id="btnCheckOut" style="background:#9889c1 !important;color:white !important;float: right;" >转账离店</button> -->
				<button class="btn btn-app btn-pink btn-sm bottom_btn hide" id="btnSelectCheckOut" data-operation="选择结账" style="float: right;" >选择结账</button>
				<button class="btn btn-app btn-purple btn-sm bottom_btn hide" id="btnSelectCheck" data-operation="选择转账" style="float: right;" >选择转账</button>
				<button class="btn btn-app btn-pink btn-sm bottom_btn" id="btnCheckOut" data-operation="结账" style="float: right;" >结账</button>
				<button class="btn btn-app btn-purple btn-sm bottom_btn" id="btnAllCheck" data-operation="全结先走" style="float: right;" >全结先走</button>
				<button class="btn btn-app btn-danger btn-sm bottom_btn" id="btnAllCheckOut" data-operation="全部结账" style="float: right;" >全部结账</button>
			</div>
		</div>
		<div id="right1" class="hide no-padding" style="position: relative;width: calc(70% - 59px);float: left;">
		
		</div>
	</div>
</div>
<!-- 数字键盘 -->
<div class="mykb-box" id="mykeyboard"></div>
<!-- 国际化 --> 
<!-- <script src="${contextPath}/static/i18n/i18nReplace.js"></script> -->
<script type="text/javascript">
	//加载资源文件
	var scripts = [
                    // "${contextPath}/static/hotel/frontoffice/huashenginitial.js",
                    // "${contextPath}/static/hotel/assets/js/jqGrid/jquery.jqGrid.js",
                    // "${contextPath}/static/hotel/assets/js/jqGrid/i18n/grid.locale-cn.js",
                    // "${contextPath}/static/hotel/frontoffice/js/popover/js/jquery.webui-popover.min.js",//快捷菜单插件
                    // //sql查询
                    // "${contextPath}/static/hotel/frontoffice/js/plug-ins/linqJson/linq.js",
                    // "${contextPath}/static/pos/js/jquery.pagination.js",//分页器
                    // "${contextPath}/static/hotel/assets/js/fuelux/fuelux.spinner.js",
                    // "${contextPath}/static/hotel/assets/js/ace/elements.spinner.js",
                    
                    // "${contextPath}/static/spa/guestAccount/jquery.plugin.guest_ftp.js",				//手牌
                    // "${contextPath}/static/spa/guestAccount/jquery.plugin.guest_xsxm.js",			//销售细目
                    // "${contextPath}/static/spa/guestAccount/jquery.plugin.guest_order.js",			//销售细目
                    // "${contextPath}/static/spa/guestAccount/jquery.plugin.guest_multi_order.js",			//点单
                    
					// "${contextPath}/static/spa/frontSpa/jquery.service.spa_init_sellte_account.js",//初始结账
					
					"assets/i18n/i18nReplace.js",
					"assets/js/fuelux/fuelux.spinner.js",
					"assets/js/ace/elements.spinner.js",
					"js/plugin/jsonsql.js",
					"js/plugin/jquery.contextmenu.r2.js",
					"js/plugin/jquery.bootstrap.modalFrame.js",
					

					"js/cashier_mana/jquery.plugin.th_search.js",
					"js/spa_guestList/jquery.plugin.guest_xsxm.js",
					"js/cashier_mana/jquery.plugin.guest_multi_order.js",

				   ]; 
	//全窗口变量
	var ins_argjson={};
	$(".page-content-area").ace_ajax("loadScripts",scripts,function(){
		// var session = ${SESSIONER};
		// ins_argjson.session = session.session;
		document.title = $.i18n.propJsp("前台收银");
		$("#pageLeft,#pageLeft1,#pageMid,#pageRight,#pageRightLedger").css("height",$(window).height()-100-73-18-60); 
		$("#pageJeContent").css("width",$("#pageBottomLeft").width()-$("#bottom_btn_div").width()-10);

		$("#pageMid").find("button").attr("disabled","disabled");
		ins_argjson.th = sysGetQueryString("th")?sysGetQueryString("th"):"";
		ins_argjson.pageRightType = "btnShowXsxm"
		ins_argjson.pageLeftType = "selectTable"
		
		$('[data-rel=tooltip]').tooltip();
		$('[data-rel=popover]').popover({html:true});

		//初始化手牌搜索框
		showThSearch()
		
		//页面事件绑定
		bindEvent();
		
		if(ins_argjson.th==""){
			$.th_search.triggerClick()
			$.th_search.toFocus()
		}else{
			searchByBh(ins_argjson.th)
		}
		
	})
	
	function showThSearch(){
		$("#pageBox").th_search({
			dataBack : function(value){
				searchByBh(value)
			},
		})
	}
	
	//页面事件绑定
	function bindEvent(){
		//关闭“其他”模态
		$(".row").click(function(){
			if($("div[role='tooltip']").size()>0){
				$("button[data-rel='popover']").removeAttr("aria-describedby")
				$("div[role='tooltip']").remove()
				$("#btnSplitCombine").trigger("click")
			}
		})
		
		$("#btnSplitCombine").click(function(){
			event.stopPropagation()
		})
		
		//全结先走
		$("#btnAllCheck").unbind("click").click(function(){ 
			$.guest_xsxm.xsxmMenu_cancel_func();
			$.guest_xsxm.xsxmMenu_allcheck_func();
			var operation = $(this).attr("data-operation")
			$("#btnCheckOut").trigger("click",operation)
		})
		
		//全部结账
		$("#btnAllCheckOut").unbind("click").click(function(){ 
			$.guest_xsxm.xsxmMenu_cancel_func();
			$.guest_xsxm.xsxmMenu_allcheckout_func();
			var operation = $(this).attr("data-operation")
			$("#btnCheckOut").trigger("click",operation)
		})
		
		//结账
		$("#btnCheckOut,#btnSelectCheckOut").unbind("click").click(function(e,operation){ 
			if(operation && operation!=""){
				$(document).data("operation",operation);
			}else{
				$(document).data("operation",$(this).attr("data-operation"));
			}
			
			var oper=ins_argjson.pageRightType;
			var nos="";
			var nos_checkout = ""
			var xhs = "";
			if(ins_argjson.pageRightType==$(this).attr("id")){
				getData();//此方法在ledger.html页面
				return;
			} 

			var no = $("#pageNo").text();
			var th = $("#pageTh").text();
			var bmh = $.HSAPI_HEADERS.bmh;
			
			var infon = {};
			
			var queryt = "select * from json where no==" + no;
			var info = JSON.parse(decodeURIComponent($(".xsxmTh_box[data-no='"+no+"']").data("mess")));
			
			if($("#btnMulti:checked").val()=="on"){
				nos=$.guest_xsxm.retrieveBrzdActive("no").join(",");
				nos_checkout=$.guest_xsxm.retrieveCheckoutActive("no").join(",");
				xhs=$.guest_xsxm.retrieveActive("xh").join(",");
				$(document).data("xhs",xhs);
			}else{
				nos=$.guest_xsxm.retrieveBrzdActive("no").join(",");
				nos_checkout=$.guest_xsxm.retrieveCheckoutActive("no").join(",");
			}
			
			var jdh=$("#pageJDH").text();

			$(document).data("jdh",jdh);
			$(document).data("no",no); 
			$(document).data("nos",nos);
			$(document).data("nos_checkout",nos_checkout);
			$(document).data("bmh",bmh);
			$(document).data("mno",(info.mno||""));
			$(document).data("th",th);
			
			
			$("#pageRightLedger").load("html/cashier_mana/ledger.html",function(responseTxt,statusTxt,xhr){      
				if(statusTxt=="success"){ 
					ins_argjson.pageRightType="btnCheckOut";   
					$("#pageRight").addClass("hide");   
			    }								    
			    if(statusTxt=="error")
			    	alert(responseTxt)
			});
			
// 			searchByBh(value)刷新左边明细
		})
		
// 		//全结先走
// 		$("#btnAllCheck").unbind("click").click(function(){
// 			$("#pageRight").spa_init_sellte_account({
// 				data : data,
// 				ct_brzd : data.ct_brzd[0],
// 				ct_brxsxm : data.ct_brxsxm,
// 				amount : data.amount[0],
// 				payment : data.payment,
// 				ho_dcode : data.ho_dcode,
// 				width : ins_argjson.width,
// 				height : ins_argjson.height,
// 				dataBack : function(){},
// 				closeBack : function(){}
// 			})
// 		})
		
		$("#btnMulti").unbind("click").click(function(){
			var multi = "no"
			if($("#btnMulti:checked").val()=="on"){
				multi = "yes"
				$("#btnSelectCheckOut").removeClass("hide")
				$("#btnSelectCheck").removeClass("hide")
				$("#btnCheckOut").addClass("hide")
				$("#btnAllCheck").addClass("hide")
				$("#btnAllCheckOut").addClass("hide")
				$("#btnXsxmFilter").removeClass("hide")
				$("#btnXsxmOut").addClass("hide")
			}else{
				multi = "no"
				$("#btnSelectCheckOut").addClass("hide")
				$("#btnSelectCheck").addClass("hide")
				$("#btnCheckOut").removeClass("hide")
				$("#btnAllCheck").removeClass("hide")
				$("#btnAllCheckOut").removeClass("hide")
				$("#btnXsxmFilter").addClass("hide")
				$("#btnXsxmOut").removeClass("hide")
			}
			
			$("#"+ins_argjson.pageRightType).trigger("click",multi)
			
			
		})
		
		//房态盘
// 		$("#btnShowFtp").unbind("click").click(function(event,arg1){ 
// 			if(ins_argjson.pageRightType=="btnCheckOut"){
// 				$("#pageRightLedger").addClass("hide"); 
// 				$("#pageRight").removeClass("hide");
// 			}
				
// 			ins_argjson.pageRightType = $(this).attr("id");
// 			var multiCheck = "no"
// 			if(arg1){
// 				multiCheck = arg1
// 			}else{
// 				if($("#btnMulti:checked").val()=="on"){
// 					$("#btnMulti").trigger("click")
// 					multiCheck = "no"
// 				}
// 			}

// 			$("#btnXsxmFilter").attr("disabled","disabled")
// 			$("#pageRight").guest_ftp({
// 				brzd_page:0,
// 				brzd_array:ins_argjson.brzd_array,
// 				pageTh:$("#pageTh").text(),
// 				multiCheck : multiCheck,
// 				dataBack : function(){
					
// 				},
// 				freshBack : function(th){
// 					searchByBh(th,function(){
// 						$.guest_ftp.changeMessage();
// 						$.guest_ftp.retrievePayable();
// 					})
// 				},
// 				clickBack:function(data){			//返回已选择钱数
// 					$("#payable").text(data)
// 				}
// 			})
// 		})
		
		//销售细目
		$("#btnShowXsxm").unbind("click").click(function(event,arg1){
			if(ins_argjson.pageRightType=="btnCheckOut"){ 
				$("#pageRightLedger").addClass("hide"); 
				$("#pageRight").removeClass("hide");
			}
			ins_argjson.pageRightType = $(this).attr("id")
			var multiCheck = "no"
			if(arg1){
				multiCheck = arg1
			}else{
				if($("#btnMulti:checked").val()=="on"){
					multiCheck = "yes"
				}else{
// 					$("#btnMulti").trigger("click")
// 					multiCheck = "yes"
				}
			}
// 			debugger
			var brzd_json = {}
			$.each(ins_argjson.brzd_array,function(key,value){
				brzd_json[value.th] = value
			})
// 			$("#btnXsxmFilter").removeAttr("disabled")
			$("#pageRight").guest_xsxm({
				xsxm_jdh_array:ins_argjson.xsxm_jdh_array,
				brzd_array:ins_argjson.brzd_array,
				brzd_json:brzd_json,
				pageTh:$("#pageTh").text(),
				multiCheck : multiCheck,
				dblClickBack : function(data){
// 					alert(JSON.stringify(data))
				},
				loadcomplete : function(){
					
				},
				freshBack : function(th){
					searchByBh(th,function(){
// 						$.guest_ftp.changeMessage();
// 						$.guest_ftp.retrievePayable();
					})
				},
				clickBack:function(data){			//返回已选择钱数
					$(".pay_p").text(data)
				}
			})
		})
		
		//过滤
		$("#btnXsxmFilter").unbind("click").click(function(){
			var datasource = $.guest_xsxm.getFilter()
			console.log(JSON.stringify(datasource))
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){   
				$("#"+modalEle).modal("show"); 
				if(!$.isFunction($().xsxmFilter)){
					$.ajaxSetup({ async: false, cache: false });
		            $.getScript( "js/cashier_mana/jquery.plugin.xsxmFilter.js");
		            $.ajaxSetup({ async: true });
				}
				$("#"+modalEle).xsxmFilter({
					datasource:datasource,
					dataBack : function(data){
						$.guest_xsxm.setSelectByXsxm(data)
					},
					closeBack : function(){
						
					},
				});
			});
		})
		
		//已结
		$("#btnXsxmOut").unbind("click").click(function(){
			var xsxm = ins_argjson.ct_brxsxm_jdh_out;
			var brzd = ins_argjson.ct_brzd_out;
			
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){  
				if(!$.isFunction($().xsxm_out)){
					$.ajaxSetup({async: false,cache: false });
		            $.getScript("js/cashier_mana/jquery.modal.xsxm_out.js");
		            $.ajaxSetup({async:true});
				}
				$("#"+modalEle).modal("show");
				$("#"+modalEle).xsxm_out({
					xsxm_jdh_array:xsxm,
					brzd_array:brzd,
					pageTh:$("#pageTh").text(),
					closeBack:function(){
						
					},
		    		dataBack:function(reason){ 
		    			
		    		},
				});
			})
		})
		
		//返回
		$("#btnBack").unbind("click").click(function(){
			if($(".bottom_btn_left.btn-info").attr("id") == ins_argjson.pageLeftType){
				if(ins_argjson.pageRightType=="btnShowXsxm"){
					window.history.go(-1);
				}else{
					$("#"+ins_argjson.pageLeftType).trigger("click")
				}
			}else{
				$("#"+ins_argjson.pageLeftType).trigger("click")
			}
		})
		
		//设置主牌
		$("#btnSetFlag").unbind("click").click(function(){
			var no = $("#pageNo").text()
			var str = {"ct_brzd":{"no":no}}
			setflag(str);
		})
		
		//退还
		$("#btnReturnDish").unbind("click").click(function(){
			var size = $("#pageLeft").find(".xsxm_box.current").size();
			if(size==0){
				jf_successDelayed($.i18n.propJsp("请选择要退还科目！！！"),2000);
				return false;
			}
			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
			var list = JSON.parse(htmlJs);
			var title =  list.mc + "&nbsp;-&nbsp;"+$.i18n.propJsp("退还");
// 			$("#btnReturnDish").attr("disabled","disabled");
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){  
				//获取菜品列表
				if(!$.isFunction($().spa_return_dish)){
					$.ajaxSetup({ async: false, cache: false });
		            $.getScript("js/cashier_mana/jquery.modal.spa_return_dish.js");
		            $.ajaxSetup({ async: true });
				}
				$("#"+modalEle).modal("show"); 
				$("#"+modalEle).spa_return_dish({
					no:(list.no||""),//no号
					title:title?title:"",//标题
					list:list?list:"",//未提交菜品 
					returnBack:function(){
// 						$("#btnReturnDish").removeAttr("disabled");
						$("#"+modalEle).empty();
						$("#"+modalEle).modal("hide"); 
					},
					dataBack:function(goposorder){
// 						$("#btnReturnDish").removeAttr("disabled");
						$("#"+modalEle).empty(); 
						$("#"+modalEle).modal("hide");
						searchByBh($("#pageTh").text())
					},
					getDefaultBack:function(){
// 						$("#btnReturnDish").removeAttr("disabled");
						$("#"+modalEle).empty(); 
						$("#"+modalEle).modal("hide");
						searchByBh($("#pageTh").text())
					}
				});
			});
		});
		
		//换牌
		$("#btnChangeTable").unbind("click").click(function(){
			var no = $("#pageNo").text()
			if(!no){
				jf_alert($.i18n.propJsp("请选择要更换的手牌！"));
				return false;
			}
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){  
				//获取菜品列表
				if(!$.isFunction($().spa_change_table)){
					$.ajaxSetup({ async: false, cache: false });
		            $.getScript("js/cashier_mana/jquery.modal.spa_change_table.js");
		            $.ajaxSetup({ async: true });
				}
				$("#"+modalEle).modal("show"); 
				$("#"+modalEle).spa_change_table({
					no:no,//no号
					title:"换牌",//标题
					closeBack:function(){
						
					},
					dataBack:function(th){
						searchByBh(th);
					},
				});
			});
			
		})
		
		//赠送
		$("#btnSpaPresent").unbind("click").click(function(){
			var size = $("#pageLeft").find(".xsxm_box.current").size();
			if(size==0){
				jf_successDelayed($.i18n.propJsp("请选择要赠送科目！！！"),2000);
				return false;
			}
			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
			var js = JSON.parse(htmlJs);
			var bmh = $.HSAPI_HEADERS.bmh
			var js1 = getalinarg("赠送限额"+bmh)[0];
			var no = $("#pageNo").text()
			
			if(parseFloat(js.je)<parseFloat(js1.s_arg)){
				var action = "";
				var xh = js.xh;
				var text = js.status_c||"";
				if(js.status_c&&JSON.stringify(text).indexOf("赠")>-1){
					action = "UNPRE"
				}else{
					action = "PRE"
				}
				
				if(action=="PRE"){
					$(this).modalFrame("destroy");
					$(this).modalFrame("init",function(modalEle){  
						if(!$.isFunction($().present_reason)){
							$.ajaxSetup({async: false,cache: false });
				            $.getScript("js/cashier_mana/jquery.modal.present_reason.js");
				            $.ajaxSetup({async:true});
						}
						$("#"+modalEle).modal("show");
						$("#"+modalEle).present_reason({
							no:no||"",
							closeBack:function(){
								return false;
							},
				    		dataBack:function(reason){
				    			var arg = {"pda_ft":{"bmh":bmh,"action":action,xh_no:xh,jgh:reason}}
								var procedure = 'POSPDA_FT'
								operMeal(arg,procedure);
				    		},
						});
					})
				}else{
					var MSG = "【" + js.mc + "】"+$.i18n.propJsp("是否取消赠送")
					jf_confirm_yn(MSG,function(re){
						if(re){
							var arg = {"pda_ft":{"bmh":bmh,"action":action,xh_no:xh,jgh:""}}
							var procedure = 'POSPDA_FT'
							operMeal(arg,procedure);
						}
					})
				}
			}else{
				jf_alert("超过赠送限额"+js1.s_arg);
			}
		})
		
		//单品折扣
		$("#btnDiscount").unbind("click").click(function(){
			var size = $("#pageLeft").find(".xsxm_box.current").size();
			if(size==0){
				jf_successDelayed($.i18n.propJsp("请选择要单品折扣科目！！！"),2000);
				return false;
			}
			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
			var js = JSON.parse(htmlJs);
			var bmh = $.HSAPI_HEADERS.bmh
			var no = $("#pageNo").text()
			
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){   
				$("#"+modalEle).modal("show"); 
				if(!$.isFunction($().spa_discount)){
					$.ajaxSetup({ async: false, cache: false });
		            $.getScript("js/cashier_mana/jquery.modal.spa_discount.js");
		            $.ajaxSetup({ async: true });
				}
				$("#"+modalEle).spa_discount({
					title:$.i18n.propJsp("单品折扣"),//标题
				    no:(no||""),//no号
				    xh : js.xh,
					dataBack:function(){
						searchByBh($("#pageTh").text());
					},
					closeBack:function(){
					
					}
				});
			});
		});
		
		//折扣金额
		$("#btnDiscountAmount").unbind("click").click(function(){
			var size = $("#pageLeft").find(".xsxm_box.current").size();
			if(size==0){
				jf_successDelayed($.i18n.propJsp("请选择要折扣金额科目！！！"),2000);
				return false;
			}
			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
			var js = JSON.parse(htmlJs);
			var bmh = $.HSAPI_HEADERS.bmh
			var no = $("#pageNo").text();
			
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){   
				$("#"+modalEle).modal("show"); 
				if(!$.isFunction($().spa_discount_amount)){
					$.ajaxSetup({ async: false, cache: false });
		            $.getScript("js/cashier_mana/jquery.modal.spa_discount_amount.js");
		            $.ajaxSetup({ async: true });
				}
				$("#"+modalEle).spa_discount_amount({
				    title:$.i18n.propJsp("折扣金额"),//标题
				    no:(no||""),//no号
				    xh : js.xh,
				    maxNumber : js.netamt,
					dataBack:function(){
						searchByBh($("#pageTh").text());
					},
					closeBack:function(){
					
					}
				});
			});
		})
		
		//单价
		$("#btnPrice").unbind("click").click(function(){
			
			var size = $("#pageLeft").find(".xsxm_box.current").size();
			if(size==0){
				jf_successDelayed($.i18n.propJsp("请选择要修改单价科目！！！"),2000);
				return false;
			}
			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
			var js = JSON.parse(htmlJs);
			var bmh = $.HSAPI_HEADERS.bmh
			var no = $("#pageNo").text();
			var status = false;
	
			if(!$.isFunction($().digitalCalculator)){
				$.ajaxSetup({ async: false, cache: false });
	            $.getScript("js/openSpa/jquery.plugin.digitalCalculator.js");
	            $.ajaxSetup({ async: true });
			}
			$("#mykeyboard").digitalCalculator({
				number:js.dj, //js.netamt,//折扣率
				status:status?status:false,
				title:$.i18n.propJsp("单价"),
				type : "pNum",
				//初始化数据返回回调
				dataBack:function(number){
					var arg = {"pda_ft":{"bmh":bmh,"action":"PRICE",xh_no:js.xh,str1:number}}
					var procedure = 'POSPDA_FT'
					operMeal(arg,procedure);
				}
			});
			
		})
		
		//身份
		$("#btnMemberCard").unbind("click").click(function(){
			
// 			var htmlJs = $("#pageLeft").find(".xsxm_box.current").find(".json").html();
// 			var js = JSON.parse(htmlJs);
			var bmh = $.HSAPI_HEADERS.bmh
			var no = $("#pageNo").text();
			var info = decodeURIComponent($("#"+no).data("mess"))
			if(!$.isFunction($().search_identity)){
				$.ajaxSetup({ async: false, cache: false });
	            $.getScript("js/cashier_mana/jquery.modal.search_identity.js");
	            $.ajaxSetup({ async: true });
			}
			$(this).modalFrame("destroy");
			$(this).modalFrame("init",function(modalEle){
				$("#"+modalEle).modal("show")
		    	$("#"+modalEle).search_identity({
		    		phone:"",		//手机号
		        	mname:"",		//会员卡
		        	text:"",		//姓名
		        	mno:"",		//mno
		        	pno:"",		//pno
		    		dataBack : function(data){
		    			$("#"+modalEle).modal("hide");
		    			$("#"+modalEle).empty();
		    			
		    			console.log(data);
		    			var arg = {"ct_brzd":{"no":no}}
		    			var mname = ""
		    			var mno = data.mno
		    			if(data['mno'] && mno!=""){
		    				mname = JSON.parse(data.mno_msg.ho_marcust_member)[0].mname;
							var dcode = JSON.parse(data.mno_msg.ho_marcust_member)[0].dcode;
		    				arg.ct_brzd['mname'] = mname;
							arg.ct_brzd['mno'] = mno;
							arg.ct_brzd['ho_marcust_dcode'] = dcode;
		    			}
		    			var pno = data.pno;
		    			var gname = "";
		    			if(data['pno'] && pno!=""){
		    				gname = data.pno_msg.gname;
		    				arg.ct_brzd['pno'] = pno;
							arg.ct_brzd['gname'] = gname;
		    			}
						var procedure = 'POSCT_brzdEditSave';
						operMeal(arg,procedure);
		    		},
		    		closeBack : function(){
		    			$("#"+modalEle).modal("hide");
		    			$("#"+modalEle).empty();
		    		},
		    	});
			})
			
		})
		
		//选台
		$("#selectTable").unbind("click").click(function(){
			$(".bottom_btn_left").removeClass("btn-info").addClass("btn-yellow")
			$(this).removeClass("btn-yellow").addClass("btn-info")
			$("#right,.oper_btn,#pageLeft,#payableContent").removeClass("hide")
			$("#right1,.oper_btn1,#pageLeft1,#pointListContent").addClass("hide")
// 			$("#btnShowFtp").trigger("click");
			$("#btnShowXsxm").trigger("click");
			
		})
		
		//入账
		$("#selectOrder").unbind("click").click(function(){
			$(".bottom_btn_left").removeClass("btn-info").addClass("btn-yellow")
			$(this).removeClass("btn-yellow").addClass("btn-info")
			$("#right1,.oper_btn1,#pageLeft").removeClass("hide")
			$("#right,.oper_btn,#pageLeft1").addClass("hide")
			
			$("#right1").guest_order({
				th:$("#pageTh").text(),
				ct_brzd:ins_argjson.ct_brzd,
				operBtnDivId:"pageMid",
				dataBack : function(){
					searchByBh($("#pageTh").text(),function(){
						$(".bottom_btn_left.btn-info").trigger("click")
						$('#pageLeft').scrollTop($('#pageLeft')[0].scrollHeight);
					})
				},
			})
		})
		
		//多点
		$("#selectMultiOrder").unbind("click").click(function(){
			$(".bottom_btn_left").removeClass("btn-info").addClass("btn-yellow")
			$(this).removeClass("btn-yellow").addClass("btn-info")
			$("#right1,.oper_btn1,#pageLeft1,#pointListContent").removeClass("hide")
			$("#right,.oper_btn,#pageLeft,#payableContent").addClass("hide")
			
			$("#right1").guest_multi_order({
				th:$("#pageTh").text(),
				ct_brzd:ins_argjson.ct_brzd,
				listDivId:"pageLeft1",
				operBtnDivId:"pageMid",
				jeDivId:"pointListActual",
				bmh:$.HSAPI_HEADERS.bmh,
				fwy : $.HSAPI_USERID,
				alertId:"#selectTable,#btnBack",
				dataBack : function(){
					searchByBh($("#pageTh").text(),function(){
						$("#selectTable").trigger("click")
// 						$('#pageLeft').scrollTop($('#pageLeft')[0].scrollHeight);
					})
				},
				returnBack : function(){ 
					if($("#pageLeft1").find(".each_undish ").length!=0){
						jf_confirm_ync($.i18n.propJsp("是否落单"),function(res){
							if(res=="是"){
								$(".saveMenu").trigger("click"); 
							}else if(res=="否"){
								$("#btnBack").trigger("click")
							}else if(res=="取消"){
								return;
							} 
						})
					}else
						$("#btnBack").trigger("click")
				},
			})
		})
	}
	
	function setflag(str){
		jQuery.ajax({  
    		type : 'POST',
    		url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",
    		data : $.HSAPI_ASKJSONINFO(JSON.stringify(str),'SPAct_brzd_SAVE_super_flag','{}'),
    		dataType : 'json',  
    		success : function(data){
   				if(data.RETURN == 1){
//                    	jf_success(data.MSG);
                   	searchByBh($("#pageTh").text())
                }else if(data.RETURN == "-10"){
                   	var MSG = data.MSG;
               		var name = data.checkbox||"name";
               		var value = (data.checkboxvalue||"");
               		
               		var checked = "";
               		if(value==1){
               			checked = "checked"
               		}
               		
               		var html = 	'<h3 class="header smaller lighter blue">'+
               						'<i class="ace-icon fa fa-bullhorn"></i>'+MSG+
               					'</h3>'+
               					'<div class="alert alert-block alert-danger">'+
               						'<label>'+
               							'<input id="checkin_cccheckbox" type="checkbox" name="'+name+'" value="" class="ace" '+checked+'/>'+
               							'<span class="lbl" style="color:#478fca;">'+MSG+'</span>'+
               						'</label>'+
               					'</div>';

               		bootbox.dialog({
               			message: html,
               			buttons:{
               				"button1":{
               					"label" : "确定",
               					"className" : "btn-sm btn-info",
               					"callback" : function(){
               						if($("#checkin_cccheckbox").prop("checked")){
               							str.arg = {}
               							str['arg'][name]="yes";
               							setflag(str)
               						}else{
               							str.arg = {}
               							str['arg'][name]="no";
               							setflag(str)
               						}
               					}
               				},	
               				"button":{
               					"label" : " 取消 ",
               					"className" : "btn-sm",
               				},
               			}
               		});
   				}else{
   					jf_alert(data.MSG);
				}
    		},  
    		error : function(data){
    			systoast('SPAct_brzd_SAVE_super_flag错误提示:','系统后台提交错!' + JSON.stringify(data),'error')
    		}  
    	});
	}
	
	//根据手牌查询信息
	function searchByBh(th,back,jdh){
		$("#pageTh").text(th)
		
		var arg = {"arg":{"th":th}}
		if(typeof(jdh)!="undefined"){ 
			arg={"arg":{"jdh":jdh}}
		} 
			
		wait()
		jQuery.ajax({  
    		type : 'POST',
    		url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",
    		data : $.HSAPI_ASKJSONINFO(JSON.stringify(arg),'SPAOrderSubLedger','{}'),
    		dataType : 'json',  
    		async:false, 
    		success : function(data){ 
    			goon();
    			if(data.RETURN==1){
    				fresh_group(data.ct_group);
    				fresh_xsxm(data.ct_brxsxm);
    				ins_argjson.brzd_array = data.ct_brzd;
    				ins_argjson.xsxm_jdh_array = data.ct_brxsxm_jdh
    				
    				ins_argjson.ct_brzd_out = data.ct_brzd_out;
   					ins_argjson.ct_brxsxm_jdh_out = data.ct_brxsxm_jdh_out;
    				
//     				var ct_brzd = jsonsql.query("select * from json where (th=='"+$("#pageTh").text()+"')", data.ct_brzd);
    				var ct_brzd = jsonsql.query("select * from json where (sele=='1')", data.ct_brzd);
    				
    				ins_argjson.ct_brzd=ct_brzd[0]
    				if(ins_argjson.ct_brzd.hasOwnProperty("jdh")) 
    					$("#pageJDH").text(ins_argjson.ct_brzd.jdh)
   					if(ins_argjson.ct_brzd.hasOwnProperty("no"))  
    					$("#pageNo").text(ins_argjson.ct_brzd.no)
    				
    				var je = '<span class="" >'+ins_argjson.ct_brzd.xfje+'</span>'
    				if(ins_argjson.ct_brzd.dfje && Number(ins_argjson.ct_brzd.dfje)!=0){
    					je += 	'<span class="" style="margin-left: 2px;color:#d15b47 !important;font-weight: bold;">('+ins_argjson.ct_brzd.dfje+')</span>';
    				}
    				$("#pageJe").html(je)
    				
//     				var th = JSON.parse(ins_argjson.ct_brzd.th_info)
// 					var th_text = ""
// 					$.each(th,function(key,value){
// 						if(JSON.stringify(value)!="{}"){
// 							var extendCss = "padding:0;line-height: 40px;font-size:17px;font-weight: bold;height: 40px;width:90%;"
// 							var id	= "pageTh"
// 							value.height = "40"
// 							th_text += getTextStyle(value,extendCss,id);
// 						}
// 					})
					var handpanel_info = JSON.parse(ins_argjson.ct_brzd.handpanel_info);
					var bgcolor = handpanel_info.bgcolor;
					var tcolor = handpanel_info.tcolor;
					
					$("#pageThArrowed").attr("style","zoom: 150%;font-size:12px;padding:0px;line-height: 26px;font-size:12px;color:white;font-weight: bold;background-color:"+bgcolor+" !important")
					var stylehtml = "<style>.label-info.arrowed-right:after{border-left-color:"+bgcolor+"}</style>";
					$("#pageThArrowed").find("style").remove()
					$("#pageThArrowed").append(stylehtml)
					
					$("#pageTh").html(ins_argjson.ct_brzd.th).css("color",tcolor);
					
    				var icon = JSON.parse(ins_argjson.ct_brzd.ico_info);
					var icon_text = "";
					$.each(icon,function(key,value){
						if(JSON.stringify(value)!="{}"){
							var extendCss = "padding: 1px 7px !important;"
							icon_text += getTextStyle(value,extendCss);
						}
					})
					$("#pageThIcon").html(icon_text).css("color",tcolor);
					
    				
					if(back){
						back()
					}else{
						if($(".bottom_btn_left.btn-info").attr("id") != "selectTable"){
							$(".bottom_btn_left.btn-info").trigger("click")
						}else{
		    				$("#"+ins_argjson.pageRightType).trigger("click")
						}
					}
    			}else{
    				if(data.hasOwnProperty("gritter")){
						if(data.hasOwnProperty("gritterstyle"))
							jf_successDelayed(data.gritter,2000,data.gritterstyle);
						else
							jf_successDelayed(data.gritter,2000); 
					}else{
	    				jf_alert(data.MSG);
					}
    				
    				$.th_search.triggerClick();
    				$.th_search.toFocus();
				}
    		},  
    		error : function(data){
    			goon();
    			jf_alert(JSON.stringify(data));
    		}  
    	});
	}
	
	//刷新销售细目列表
	function fresh_xsxm(xsxm_array){
		if(xsxm_array.length==0){
			$("#pageMid").find("button").attr("disabled","disabled");
		}else{
			$("#pageMid").find("button").removeAttr("disabled");
		}
		$("#pageLeft").empty()
		$.each(xsxm_array,function(key,value){
			
			//标记
			if(typeof(value.status_c)=="string"&&value.status_c!="{}"){
				value.status_c = $.parseJSON(value.status_c);
			}
			var showRevHtml= ""
			if(value.status_c.length>0){
				$(value.status_c).each(function(k,v){
					if(JSON.stringify(v)!="{}"){
						showRevHtml += '<span class="badge" style="background:'+(v.bgcolor||"#00FF00")+' !important;color:'+(v.scolor||"black")+';">'+v.name+'</span>';
					}
				})
			}
			
			//名称颜色
			var color = "#2b8ccc;"
			if(value.sort==1){
				color = "#999";
			}
			
			//备注 被info取代
// 			var bz=""
// 			var bzclass=""
// 			var sl=1
// 			if(!value.bz && !value.tsyq){
// 				bzclass=" hide"//无数据隐藏
// 			}else if(!!value.bz && !value.tsyq){
// 				bz=value.bz
// 			}else if(!value.bz && !!value.tsyq){
// 				bz=value.tsyq
// 			}else{
// 				bz=value.tsyq + value.bz
// 			}
			
			//框样式
			if(!value.panel_info){
				value.panel_info = '{"bgcolor":"#fffafa","tcolor":"#00008B"}'
			}
			var panel_info =  JSON.parse(value.panel_info)
			var bgcolor = (panel_info['bgcolor']?panel_info['bgcolor']:"#fffafa")
			var tcolor = (panel_info['tcolor']?panel_info['tcolor']:"#00008B")
			
			var info = JSON.parse(value.info)
			var info_text = ""
			$.each(info,function(kk,vv){
				if(JSON.stringify(vv)!="{}"){
					info_text += 
						'<div class="right_xsxm_box-1" style="background-color:'+bgcolor+';color:'+tcolor+';">'+
							getTextStyle(vv)+
						'</div>';
				}
			})
			
			var info_tc = JSON.parse(value.info_tc)
			var info_tc_text = ""
			$.each(info_tc,function(kk,vv){
				if(JSON.stringify(vv)!="{}"){
					info_tc_text += 
						'<div class="right_xsxm_box-1" style="background-color:'+bgcolor+';color:'+tcolor+';">'+
							getTextStyle(vv)+
						'</div>';
				}
			})
			
			var html = 	'<style>'+
							'.xsxm_box.current {background: #2d8dcd !important;border: none !important;border: 2px solid #d15b47 !important;margin: 2px;}'+		
							' .eachRemark{text-overflow: ellipsis;display: -webkit-box; overflow: hidden;-webkit-line-clamp: 1 !important;-webkit-box-orient: vertical;margin-left: 3%;color:#5A5A5A;font-size:12px;}'+
							'.right_xsxm_box-1{cursor: pointer;float: left;border: 1.5px solid #e2d8d8;border-radius: 3px;position: relative;margin:1px 0px 1px 3px;height: auto;padding: 4px 5px;height:30px;font-size:13px;line-height:19px;}'+//background:snow;color:#00008B;
						'</style>'+
						'<div id="'+value.xh+'" data-xh="'+value.xh+'">'+
							
							'<div class="btn btn-app btn-light no-radius xsxm_box" style="padding-bottom:2px !important;">'+
								'<div class="json hide">'+
									JSON.stringify(value)+
								'</div>'+
								'<div class="xsxm_box_top flex">'+
									'<div class="xsxm_box_top_left flex" style="color:'+color+'">'+
										'<div class="eachKey" >'+(key+1)+'</div>'+
										'<span>.</span>'+
										'<div class="eachName" >'+value.mc+'</div>'+
									'</div>'+
									'<div class="xsxm_box_top_right flex">'+
										'<div class="eachPirce">'+value.dj+'/份</div>'+
										'<span>×</span>'+
										'<div class="eachNumber">'+value.sl+'</div>'+
									'</div>'+
								'</div>'+
								'<div class="xsxm_box_center flex">'+
								'</div>'+
								'<div class="xsxm_box_bottom flex">'+
									'<div class="xsxm_box_top_left flex" style="flex-wrap: wrap;">'+
// 										'<div class="eachRemark '+bzclass+'">'+
// 											bz+
// 										'</div>'+
										info_text+
									'</div>'+
									'<div class="xsxm_box_top_right flex">'+
										'<div>'+
											showRevHtml+
										'</div>'+
										'<div class="eachJe">'+value.je+'</div>'+
									'</div>'+
								'</div>'+
								'<div class="xsxm_box_bottom flex" style="flex-wrap: wrap;">'+
									info_tc_text+
								'</div>'+
							'</div>'+
						'</div>';
			$("#pageLeft").append(html)
			
			$("#pageLeft").find(".xsxm_box").unbind("click").click(function(){
				$("#pageLeft").find(".xsxm_box").removeClass("current");
				$(this).addClass("current");
			})
		})
	}
	
	function fresh_group(ct_group_array){
		$("#pageJdh").html(ct_group_array[0]['jdh'])
		var info1 = JSON.parse(ct_group_array[0]['info1'])
		var info1_text = ""
		$.each(info1,function(key,value){
			if(JSON.stringify(value)!="{}"){
				if(info1_text!=""){
					info1_text += ","
				}
				info1_text += getTextStyle(value);
			}
		})
		$("#pageInfo1").html(info1_text)
		
		var info2 = JSON.parse(ct_group_array[0]['info2'])
		var info2_text = ""
		$.each(info2,function(key,value){
			if(JSON.stringify(value)!="{}"){
				if(info2_text!=""){
					info2_text += ","
				}
				info2_text += getTextStyle(value);
			}
		})
		$("#pageInfo1").html(info1_text)
		$("#pageInfo2").html(info2_text)
		
	}
	
	function wait(){
		$("#pageOverlay").removeClass("hide");
		$("#loading").removeClass("hide");
	}
	
	function goon(){
		$("#pageOverlay").addClass("hide");
		$("#loading").addClass("hide");
	}
	
	function operMeal(arg,procedure){
		wait()
		$.ajax({  
    		type : 'POST',
    		url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",   
    		data : $.HSAPI_ASKJSONINFO(JSON.stringify(arg),procedure,'{}'),
    		dataType : 'json',  
    		success : function(data){
    			goon()
				if(data.RETURN==1){
					jf_success(data.MSG);
					searchByBh($("#pageTh").text());
				}else{
					jf_alert(data.MSG)
				}
    		},  
    		error : function(data){
    			goon()
    			jf_alert(JSON.stringify(data));
    		}  
    	});
	}
	
</script>